1 % Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
3 {\ttfamily \raggedright {
5 \mbox{}\textit{\textcolor{Brown
}{//P\ es\ un\ polĂgono\ ordenado\ anticlockwise.
}} \\
6 \mbox{}\textit{\textcolor{Brown
}{//Si\ es\ clockwise,\ retorna\ el\ area\ negativa.
}} \\
7 \mbox{}\textit{\textcolor{Brown
}{//Si\ no\ esta\ ordenado\ retorna\ pura\ mierda.
}} \\
8 \mbox{}\textit{\textcolor{Brown
}{//P
[0]\ !=\ P
[n-
1]}} \\
9 \mbox{}\textcolor{ForestGreen
}{double
}\
\textbf{\textcolor{Black
}{PolygonArea
}}\textcolor{BrickRed
}{(
}\textbf{\textcolor{Blue
}{const
}}\ vector
\textcolor{BrickRed
}{$<$
}point
\textcolor{BrickRed
}{$>$
}\
\textcolor{BrickRed
}{\&
}p
\textcolor{BrickRed
}{)
}\textcolor{Red
}{\
{} \\
10 \mbox{}\ \
\textcolor{ForestGreen
}{double
}\ r\
\textcolor{BrickRed
}{=
}\
\textcolor{Purple
}{0.0}\textcolor{BrickRed
}{;
} \\
11 \mbox{}\ \
\textbf{\textcolor{Blue
}{for
}}\
\textcolor{BrickRed
}{(
}\textcolor{ForestGreen
}{int
}\ i
\textcolor{BrickRed
}{=
}\textcolor{Purple
}{0}\textcolor{BrickRed
}{;
}\ i
\textcolor{BrickRed
}{$<$
}p
\textcolor{BrickRed
}{.
}\textbf{\textcolor{Black
}{size
}}\textcolor{BrickRed
}{();
}\
\textcolor{BrickRed
}{++
}i
\textcolor{BrickRed
}{)
}\textcolor{Red
}{\
{} \\
12 \mbox{}\ \ \ \
\textcolor{ForestGreen
}{int
}\ j\
\textcolor{BrickRed
}{=
}\
\textcolor{BrickRed
}{(
}i
\textcolor{BrickRed
}{+
}\textcolor{Purple
}{1}\textcolor{BrickRed
}{)
}\
\textcolor{BrickRed
}{\%
}\ p
\textcolor{BrickRed
}{.
}\textbf{\textcolor{Black
}{size
}}\textcolor{BrickRed
}{();
} \\
13 \mbox{}\ \ \ \ r\
\textcolor{BrickRed
}{+=
}\ p
\textcolor{BrickRed
}{[}i
\textcolor{BrickRed
}{].
}x
\textcolor{BrickRed
}{*
}p
\textcolor{BrickRed
}{[}j
\textcolor{BrickRed
}{].
}y\
\textcolor{BrickRed
}{-
}\ p
\textcolor{BrickRed
}{[}j
\textcolor{BrickRed
}{].
}x
\textcolor{BrickRed
}{*
}p
\textcolor{BrickRed
}{[}i
\textcolor{BrickRed
}{].
}y
\textcolor{BrickRed
}{;
} \\
14 \mbox{}\ \
\textcolor{Red
}{\
}} \\
15 \mbox{}\ \
\textbf{\textcolor{Blue
}{return
}}\ r
\textcolor{BrickRed
}{/
}\textcolor{Purple
}{2.0}\textcolor{BrickRed
}{;
} \\
16 \mbox{}\textcolor{Red
}{\
}} \\
18 } \normalfont\normalsize